Import data

Univariate EDA

Predictor variables

## year
## 1982 1983 1984 1985 1986 1987 1988 
##   48   48   48   48   48   48   48

Question: do we want to round down the drink age? Then make this categorical?

## drinkage
##               18             18.5               19 19.1599998474121 
##               12                3               49                1 
##            19.25             19.5 19.6700000762939               20 
##                2                2                6               20 
##            20.25 20.3299999237061             20.5               21 
##                1                2                6              232

Response variables

Multivariate EDA

mean response plot:

jail and service have shown slight increase by year.
drinkage have mainly shifted from 18-19 in 1982 to 21 in 1988.

##      year
## jail  1982 1983 1984 1985 1986 1987 1988
##   no    39   35   34   33   33   34   33
##   yes    9   13   14   15   15   14   14
##        year
## service 1982 1983 1984 1985 1986 1987 1988
##     no    43   40   39   38   38   38   37
##     yes    5    8    9   10   10   10   10
##             year
## drinkage_cat 1982 1983 1984 1985 1986 1987 1988
##           18    5    4    3    2    1    0    0
##           19   13   13   13   11    8    1    1
##           20    6    6    6    5    3    3    0
##           21   24   25   26   30   36   44   47

Model fitting

Note: goal is to observe whether the type of law implemented to tacker drunk driving can actually prevent fatalities

## Oneway (individual) effect Within Model
## 
## Call:
## plm(formula = afatal_prop ~ beertax + jail + service + drinkage, 
##     data = Fatalities, model = "within", index = "state")
## 
## Unbalanced Panel: n = 48, T = 6-7, N = 335
## 
## Residuals:
##       Min.    1st Qu.     Median    3rd Qu.       Max. 
## -0.3434894 -0.0256639 -0.0016049  0.0204173  0.2303012 
## 
## Coefficients:
##              Estimate Std. Error t-value  Pr(>|t|)    
## beertax     0.0581056  0.0527138  1.1023 0.2712746    
## jailyes     0.1431230  0.0398392  3.5925 0.0003861 ***
## serviceyes -0.1659102  0.0454909 -3.6471 0.0003156 ***
## drinkage   -0.0179305  0.0048585 -3.6906 0.0002683 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Total Sum of Squares:    0.85673
## Residual Sum of Squares: 0.76982
## R-Squared:      0.10145
## Adj. R-Squared: -0.060485
## F-statistic: 7.98754 on 4 and 283 DF, p-value: 4.1001e-06
## Linear mixed model fit by REML ['lmerMod']
## Formula: afatal_prop ~ beertax + jail + service + drinkage_cat + (1 |  
##     year)
## 
## REML criterion at convergence: -722.4
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.1522 -0.6233 -0.1613  0.3997  4.1285 
## 
## Random effects:
##  Groups   Name        Variance  Std.Dev.
##  year     (Intercept) 0.0003185 0.01785 
##  Residual             0.0058122 0.07624 
## Number of obs: 335, groups:  year, 7
## 
## Fixed effects:
##                 Estimate Std. Error t value
## (Intercept)     0.320246   0.022154  14.455
## beertax         0.020979   0.008871   2.365
## jailyes         0.032811   0.011160   2.940
## serviceyes     -0.033128   0.012993  -2.550
## drinkage_cat19 -0.011387   0.022220  -0.512
## drinkage_cat20 -0.006957   0.024473  -0.284
## drinkage_cat21 -0.014572   0.020862  -0.699
## 
## Correlation of Fixed Effects:
##             (Intr) beertx jailys srvcys drn_19 drn_20
## beertax     -0.220                                   
## jailyes     -0.168  0.125                            
## serviceyes  -0.033 -0.163 -0.539                     
## drinkg_ct19 -0.809 -0.020 -0.011  0.107              
## drinkg_ct20 -0.749  0.007  0.044  0.065  0.729       
## drinkg_ct21 -0.897  0.025  0.088  0.013  0.853  0.782
## Analysis of Variance Table
##              npar   Sum Sq  Mean Sq F value
## beertax         1 0.022204 0.022204  3.8202
## jail            1 0.023080 0.023080  3.9710
## service         1 0.040522 0.040522  6.9718
## drinkage_cat    3 0.003903 0.001301  0.2238
## 
## Call:
## lm(formula = afatal_prop ~ beertax + jail + service + drinkage_cat + 
##     state + year)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.35466 -0.02248  0.00015  0.01619  0.20188 
## 
## Coefficients:
##                 Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     0.385879   0.092139   4.188 3.79e-05 ***
## beertax        -0.020500   0.052949  -0.387 0.698931    
## jailyes         0.139363   0.038217   3.647 0.000318 ***
## serviceyes     -0.127551   0.043811  -2.911 0.003893 ** 
## drinkage_cat19  0.023605   0.019949   1.183 0.237727    
## drinkage_cat20  0.019948   0.021905   0.911 0.363280    
## drinkage_cat21  0.017331   0.020887   0.830 0.407388    
## stateaz        -0.116987   0.080215  -1.458 0.145867    
## statear         0.040503   0.061450   0.659 0.510367    
## stateca        -0.096109   0.086312  -1.114 0.266460    
## stateco         0.070782   0.095030   0.745 0.457005    
## statect        -0.015133   0.080915  -0.187 0.851777    
## statede        -0.052495   0.082245  -0.638 0.523826    
## statefl         0.068501   0.059404   1.153 0.249860    
## statega        -0.009247   0.050921  -0.182 0.856038    
## stateid        -0.051942   0.071645  -0.725 0.469073    
## stateil        -0.067462   0.082035  -0.822 0.411585    
## statein        -0.041957   0.076659  -0.547 0.584604    
## stateia         0.025750   0.070389   0.366 0.714778    
## stateks         0.070772   0.074916   0.945 0.345646    
## stateky        -0.051665   0.080807  -0.639 0.523117    
## statela         0.028730   0.060946   0.471 0.637726    
## stateme        -0.164942   0.064773  -2.546 0.011427 *  
## statemd        -0.109328   0.079688  -1.372 0.171198    
## statema        -0.042311   0.076896  -0.550 0.582602    
## statemi        -0.024254   0.066287  -0.366 0.714729    
## statemn        -0.069333   0.073858  -0.939 0.348690    
## statems         0.173500   0.041241   4.207 3.51e-05 ***
## statemo        -0.019088   0.074999  -0.255 0.799294    
## statemt        -0.129653   0.082326  -1.575 0.116436    
## statene        -0.077424   0.069420  -1.115 0.265697    
## statenv        -0.098237   0.084936  -1.157 0.248436    
## statenh        -0.012067   0.058106  -0.208 0.835642    
## statenj        -0.142654   0.086280  -1.653 0.099395 .  
## statenm        -0.084602   0.071488  -1.183 0.237657    
## stateny        -0.148081   0.083534  -1.773 0.077386 .  
## statenc        -0.050935   0.032910  -1.548 0.122843    
## statend         0.102137   0.071344   1.432 0.153391    
## stateoh         0.016797   0.074223   0.226 0.821134    
## stateok        -0.074009   0.047192  -1.568 0.117973    
## stateor        -0.096236   0.083853  -1.148 0.252102    
## statepa        -0.045403   0.077669  -0.585 0.559314    
## stateri        -0.042844   0.082017  -0.522 0.601822    
## statesc         0.024190   0.034280   0.706 0.481013    
## statesd        -0.058141   0.058771  -0.989 0.323399    
## statetn        -0.167806   0.083530  -2.009 0.045521 *  
## statetx         0.049061   0.068292   0.718 0.473116    
## stateut        -0.141885   0.060179  -2.358 0.019087 *  
## statevt        -0.033412   0.060034  -0.557 0.578293    
## stateva        -0.080420   0.057214  -1.406 0.160972    
## statewa        -0.174842   0.087810  -1.991 0.047456 *  
## statewv        -0.169783   0.078554  -2.161 0.031531 *  
## statewi        -0.019855   0.082927  -0.239 0.810954    
## statewy        -0.168777   0.095070  -1.775 0.076954 .  
## year1983       -0.024575   0.010218  -2.405 0.016829 *  
## year1984       -0.030428   0.010314  -2.950 0.003450 ** 
## year1985       -0.047003   0.010545  -4.457 1.21e-05 ***
## year1986       -0.050025   0.010875  -4.600 6.45e-06 ***
## year1987       -0.062518   0.011635  -5.373 1.65e-07 ***
## year1988       -0.065529   0.012157  -5.390 1.52e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.04943 on 275 degrees of freedom
##   (1 observation deleted due to missingness)
## Multiple R-squared:  0.6802, Adjusted R-squared:  0.6116 
## F-statistic: 9.915 on 59 and 275 DF,  p-value: < 2.2e-16
## Analysis of Variance Table
## 
## Response: afatal_prop
##               Df  Sum Sq  Mean Sq F value    Pr(>F)    
## beertax        1 0.02485 0.024846 10.1703  0.001592 ** 
## jail           1 0.01760 0.017596  7.2026  0.007721 ** 
## service        1 0.04768 0.047679 19.5169 1.436e-05 ***
## drinkage_cat   3 0.02312 0.007708  3.1550  0.025295 *  
## state         47 1.21970 0.025951 10.6229 < 2.2e-16 ***
## year           6 0.09620 0.016033  6.5628 1.710e-06 ***
## Residuals    275 0.67181 0.002443                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1